#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

int n;
vector<pair<int, int>> pts;
vector<vector<double>> dis;
vector<int> path;
vector<int> bestv;
double best = 0;

void genData(int n) {
    ::n = n;
    pts.resize(n);
    for (int i = 0; i < n; i++) {
        pts[i] = make_pair(rand() % (10 * n), rand() % (10 * n));
    }
    sort(pts.begin(), pts.end());
    dis.resize(n);
    for (int i = 0; i < n; i++) {
        dis[i].resize(n);
        for (int j = 0; j < n; j++) {
            dis[i][j] = hypot(pts[i].first - pts[j].first, pts[i].second - pts[j].second);
        }
    }
    cout << n << endl;
    for (auto pt:pts) {
        cout << pt.first << " " << pt.second << endl;
    }
    for (int i = 0; i < n; i++) {

        for (int j = 0; j < n; j++) {
            cout << " " << fixed << setprecision(2) << dis[i][j];
        }
        cout << endl;
    }
}

double eval(vector<int> &path) {
    double s = 0;
    for (int i = 0; i < n; i++) {
        s += dis[path[i]][path[(i + 1) % n]];
    }
    return s;
}

void solve() {

    vector<bool> book(n);
    bestv.push_back(0);
    book[0] = true;
    int u = 0;
    for (int i = 1; i < n; i++) {
        double best = INT_MAX;
        int p = -1;
        for (int j = 0; j < n; j++) {
            if (book[j])continue;
            if (dis[u][j] < best) {
                best = dis[u][j];
                p = j;
            }
        }
        bestv.push_back(p);
        book[p]=true;
        u=p;

    }
    for (int i = 0; i < n; i++) {
        cout << bestv[i] << " ";
    }
    cout << endl;
    cout << (best=eval(bestv)) << endl;


}

int main() {
    //srand(time(NULL));
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    genData(10);
    solve();
    return 0;
}
